.class public Lcom/zuiapps/library/helper/ZMUpgradeHelper;
.super Ljava/lang/Object;
.source "ZMUpgradeHelper.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/zuiapps/library/helper/ZMUpgradeHelper$ZMUpgradeCheckCallback;,
        Lcom/zuiapps/library/helper/ZMUpgradeHelper$ZMUpdateCallback;
    }
.end annotation


# static fields
.field private static final TAG:Ljava/lang/String; = "ZMUpgradeHelper"


# direct methods
.method public constructor <init>()V
    .registers 1

    .prologue
    .line 32
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 225
    return-void
.end method

.method public static checkUpgradeAutomatically(Landroid/content/Context;)V
    .registers 3
    .param p0, "context"    # Landroid/content/Context;

    .prologue
    .line 135
    const/4 v0, 0x1

    new-instance v1, Lcom/zuiapps/library/helper/ZMUpgradeHelper$3;

    invoke-direct {v1, p0}, Lcom/zuiapps/library/helper/ZMUpgradeHelper$3;-><init>(Landroid/content/Context;)V

    invoke-static {p0, v0, v1}, Lcom/zuiapps/library/helper/ZMUpgradeHelper;->onUpgradeEvent(Landroid/content/Context;ZLcom/zuiapps/library/helper/ZMUpgradeHelper$ZMUpdateCallback;)V

    .line 150
    return-void
.end method

.method public static checkUpgradeManually(Landroid/content/Context;)V
    .registers 3
    .param p0, "context"    # Landroid/content/Context;

    .prologue
    .line 40
    const/4 v0, 0x0

    new-instance v1, Lcom/zuiapps/library/helper/ZMUpgradeHelper$1;

    invoke-direct {v1, p0}, Lcom/zuiapps/library/helper/ZMUpgradeHelper$1;-><init>(Landroid/content/Context;)V

    invoke-static {p0, v0, v1}, Lcom/zuiapps/library/helper/ZMUpgradeHelper;->onUpgradeEvent(Landroid/content/Context;ZLcom/zuiapps/library/helper/ZMUpgradeHelper$ZMUpdateCallback;)V

    .line 61
    return-void
.end method

.method public static checkUpgradeManually(Landroid/content/Context;Lcom/zuiapps/library/helper/ZMUpgradeHelper$ZMUpgradeCheckCallback;)V
    .registers 5
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "callback"    # Lcom/zuiapps/library/helper/ZMUpgradeHelper$ZMUpgradeCheckCallback;

    .prologue
    .line 71
    invoke-static {p0}, Lcom/zuiapps/library/restful/UpgradeReqRestAdapter;->getInstance(Landroid/content/Context;)Lretrofit/RestAdapter;

    move-result-object v1

    const-class v2, Lcom/zuiapps/library/restful/UpgradeRestful;

    invoke-virtual {v1, v2}, Lretrofit/RestAdapter;->create(Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/zuiapps/library/restful/UpgradeRestful;

    .line 72
    .local v0, "mRequest":Lcom/zuiapps/library/restful/UpgradeRestful;
    invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v1

    new-instance v2, Lcom/zuiapps/library/helper/ZMUpgradeHelper$2;

    invoke-direct {v2, p0, p1}, Lcom/zuiapps/library/helper/ZMUpgradeHelper$2;-><init>(Landroid/content/Context;Lcom/zuiapps/library/helper/ZMUpgradeHelper$ZMUpgradeCheckCallback;)V

    invoke-interface {v0, v1, v2}, Lcom/zuiapps/library/restful/UpgradeRestful;->upgradeData(Ljava/lang/String;Lretrofit/Callback;)V

    .line 96
    return-void
.end method

.method public static getLastVersionCode(Landroid/content/Context;)I
    .registers 4
    .param p0, "context"    # Landroid/content/Context;

    .prologue
    .line 106
    invoke-static {p0}, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->getInstance(Landroid/content/Context;)Lcom/zuiapps/library/db/UpgradeSharePrefHelper;

    move-result-object v0

    const-string v1, "last_version"

    const/4 v2, 0x0

    invoke-virtual {v0, v1, v2}, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->getPref(Ljava/lang/String;I)I

    move-result v0

    return v0
.end method

.method public static getUpdateDesc(Landroid/content/Context;)Ljava/lang/String;
    .registers 4
    .param p0, "context"    # Landroid/content/Context;

    .prologue
    .line 116
    invoke-static {p0}, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->getInstance(Landroid/content/Context;)Lcom/zuiapps/library/db/UpgradeSharePrefHelper;

    move-result-object v0

    const-string v1, "update_desc"

    const-string v2, ""

    invoke-virtual {v0, v1, v2}, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->getPref(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public static getUpdateURL(Landroid/content/Context;)Ljava/lang/String;
    .registers 4
    .param p0, "context"    # Landroid/content/Context;

    .prologue
    .line 126
    invoke-static {p0}, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->getInstance(Landroid/content/Context;)Lcom/zuiapps/library/db/UpgradeSharePrefHelper;

    move-result-object v0

    const-string v1, "update_url"

    const-string v2, ""

    invoke-virtual {v0, v1, v2}, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->getPref(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public static onUpgradeEvent(Landroid/content/Context;ZLcom/zuiapps/library/helper/ZMUpgradeHelper$ZMUpdateCallback;)V
    .registers 6
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "isUpgradeByAuto"    # Z
    .param p2, "callback"    # Lcom/zuiapps/library/helper/ZMUpgradeHelper$ZMUpdateCallback;

    .prologue
    .line 154
    invoke-static {p0}, Lcom/zuiapps/library/restful/UpgradeReqRestAdapter;->getInstance(Landroid/content/Context;)Lretrofit/RestAdapter;

    move-result-object v1

    const-class v2, Lcom/zuiapps/library/restful/UpgradeRestful;

    invoke-virtual {v1, v2}, Lretrofit/RestAdapter;->create(Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/zuiapps/library/restful/UpgradeRestful;

    .line 155
    .local v0, "mRequest":Lcom/zuiapps/library/restful/UpgradeRestful;
    invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v1

    new-instance v2, Lcom/zuiapps/library/helper/ZMUpgradeHelper$4;

    invoke-direct {v2, p0, p1, p2}, Lcom/zuiapps/library/helper/ZMUpgradeHelper$4;-><init>(Landroid/content/Context;ZLcom/zuiapps/library/helper/ZMUpgradeHelper$ZMUpdateCallback;)V

    invoke-interface {v0, v1, v2}, Lcom/zuiapps/library/restful/UpgradeRestful;->upgradeData(Ljava/lang/String;Lretrofit/Callback;)V

    .line 216
    return-void
.end method
